
/*
Spell has a random chance to heal for 500, damage for 500, apply poison, or increase attack by 25%
*/


class RANDOM: public SPELL
{
public:
	RANDOM()
	{
		SetName("Random");
		SetPrice(4000);
		SetManaCost(30);
		SetMagnitude(500);
		SetSpellType(ST_RANDOM);
	}

	RANDOM(RANDOM* newspell)
	{
		SetName(newspell->GetName());
		SetPrice(newspell->GetPrice());
		SetManaCost(newspell->GetManaCost());
		SetMagnitude(newspell->GetMagnitude());
		SetSpellType(newspell->GetSpellType());
	}

	void Cast(ENTITY* elist,int ecount)
	{
		cout << "You mutter some random words...\n";
		Wait();

		//pick a random number
		int random = rand()%4;

		switch (random)
		{
		case 0:
			{
				cout << elist->GetName() << " is healed for " << GetMagnitude() << " health.\n";
				elist->AddHealth(GetMagnitude());
				break;
			}
		case 1:
			{
				cout << elist->GetName() << " is damaged for " << GetMagnitude() << " health.\n";
				elist->LoseHealth(GetMagnitude());
				break;
			}
		case 2:
			{
				cout << elist->GetName() << " is poisoned.\n";
				elist->SetPoisoned(true);
				break;
			}
		case 3:
			{
				if (elist->IsMonster())
				{
					cout << elist->GetName() << " goes berzerk. (Attack up)\n";

					//typecast to monster class using a pointer
					MONSTER *monster = (MONSTER*)elist;
					monster->SetAttack((int)(monster->GetAttack() * 1.25f));
				}
				else
				{
					cout << "but nothing happens.\n";
				}
				break;
			}

		default:
			break;
		}
	}
};